<extend name="Base/base" />
<block name="button">
	<button class="btn btn-primary" type="submit" form="form"><i class="fa fa-save"></i> {:L('text_save')}</button>
</block>
<block name="body">
	<div class="panel panel-default">
		<div class="panel-heading">
			<h4><i class="fa fa-pencil fa-fw"></i>  {$heading_title}</h4>
		</div>
		<div class="panel-body">
			<form action="__SELF__" method="post" id="form" class="form-horizontal">				
				<ul class="nav nav-tabs">
					<li class="active">
						<a href="#home" data-toggle="tab">{:L('tab_home')}</a>
					</li>
					<li>
						<a href="#manage" data-toggle="tab">{:L('tab_manage')}</a>
					</li>
					<li>
						<a href="#tab-common" data-toggle="tab">{:L('tab_common')}</a>
					</li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane active" id="home">
						<ul class="nav nav-tabs">
							<foreach name="config['Home']" item="chome">
								<li class="{$key?'':'active'}" >
								<a href="#tab-home-{$chome.config_group_id}" data-toggle="tab">{$chome.title}</a></li>
							</foreach>
						</ul>
						<div class="tab-content">
						<foreach name="config['Home']" item="chome">
							<div class="tab-pane {$key?'':'active'}" id="tab-home-{$chome.config_group_id}">
								<foreach name="chome['config']" item="cf">
									<div class="form-group">
										<label for="input-{$chome.config_group_id}-{$cf.key}" class="col-sm-2 control-label">{$cf.title}  <if condition="$cf['remark']"><span class="text-primary" data-toggle="tooltip" title="{$cf.remark}"><i class="fa fa-question-circle"></i></span></if></label>
										<div class="col-sm-10">
											<switch name="cf['type']">
												<case value="1">
													<input type="text" name="Home[{$cf.key}]" class="form-control" placeholder="{$cf.title}" value="{$cf.value|default=''}" id="input-{$chome.config_group_id}-{$cf.key}">
												</case>
												<case value="2">
													<input type="number" name="Home[{$cf.key}]" class="form-control" placeholder="{$cf.title}" value="{$cf.value|default=''}" id="input-{$chome.config_group_id}-{$cf.key}">													
												</case>
												<case value="3">
													<label class="radio-inline">
														<input type="radio" value="1" class="form-control" name="Home[{$cf.key}]" {:(isset($cf['value']) && $cf['value']==1)?'checked':''}> {:L('text_yes')}
													</label>
													<label class="radio-inline">
														<input type="radio" value="0" name="Home[{$cf.key}]" {:(isset($cf['value']) && $cf['value']==1)?'':'checked'}> {:L('text_no')}
													</label>
												</case>
												<case value="4">
													<select name="Home[{$cf.key}]" id="input-{$chome.config_group_id}-{$cf.key}" class="form-control">
														<foreach name="cf['extra']" item="ext">
															<option {:(isset($cf['value']) && $cf['value']==$ext['value'])?'selected':''} value="{$ext.value}">{$ext.title}</option>
														</foreach>
													</select>
												</case>
												<case value="5">
													<a href="" id="thumb-image-{$chome.config_group_id}-{$cf.key}" data-toggle="image" class="img-thumbnail"><img src="{$cf['thumb']}" alt="" title="" data-placeholder="{$placeholder}" /></a>
                  									<input type="hidden" name="Home[{$cf.key}]" value="{$cf.value|default=''}" id="input-{$chome.config_group_id}-{$cf.key}" />
												</case>
												<default/>
											</switch>
										</div>
									</div>
								</foreach>
							</div>
						</foreach>
						</div>
					</div>
					<div class="tab-pane" id="manage">
						<ul class="nav nav-tabs">
							<foreach name="config['Manage']" item="cmanage">
								<li class="{$key?'':'active'}" >
								<a href="#tab-manage-{$cmanage.config_group_id}" data-toggle="tab">{$chome.title}</a></li>
							</foreach>
						</ul>
						<div class="tab-content">
						<foreach name="config['Manage']" item="cmanage">
							<div class="tab-pane {$key?'':'active'}" id="tab-manage-{$cmanage.config_group_id}">
								<foreach name="cmanage['config']" item="cf">
									<div class="form-group">
										<label for="input-{$cmanage.config_group_id}-{$cf.key}" class="col-sm-2 control-label">{$cf.title}  <if condition="$cf['remark']"><span class="text-primary" data-toggle="tooltip" title="{$cf.remark}"><i class="fa fa-question-circle"></i></span></if></label>
										<div class="col-sm-10">
											<switch name="cf['type']">
												<case value="1">
													<input type="text" name="Manage[{$cf.key}]" class="form-control" placeholder="{$cf.title}" value="{$cf.value|default=''}" id="input-{$cmanage.config_group_id}-{$cf.key}">
												</case>
												<case value="2">
													<input type="number" name="Manage[{$cf.key}]" class="form-control" placeholder="{$cf.title}" value="{$cf.value|default=''}" id="input-{$cmanage.config_group_id}-{$cf.key}">													
												</case>
												<case value="3">
													<label class="radio-inline">
														<input type="radio" value="1" name="Manage[{$cf.key}]" {:(isset($cf['value']) && $cf['value']==1)?'checked':''}> {:L('text_yes')}
													</label>
													<label class="radio-inline">
														<input type="radio" value="0" name="Manage[{$cf.key}]" {:(isset($cf['value']) && $cf['value']==1)?'':'checked'}> {:L('text_no')}
													</label>
												</case>
												<case value="4">
													<select name="Manage[{$cf.key}]" id="input-{$cmanage.config_group_id}-{$cf.key}" class="form-control">
														<foreach name="cf['extra']" item="ext">
															<option {:(isset($cf['value']) && $cf['value']==$ext['value'])?'selected':''} value="{$ext.value}">{$ext.title}</option>
														</foreach>
													</select>
												</case>
												<case value="5">
													<a href="" id="thumb-image-{$cmanage.config_group_id}-{$cf.key}" data-toggle="image" class="img-thumbnail"><img src="{$cf['thumb']}" alt="" title="" data-placeholder="{$placeholder}" /></a>
                  									<input type="hidden" name="Manage[{$cf.key}]" value="{$cf.value|default=''}" id="input-{$cmanage.config_group_id}-{$cf.key}" />
												</case>
												<default/>
											</switch>
										</div>
									</div>
								</foreach>
							</div>
						</foreach>
						</div>
					</div>
					<div class="tab-pane" id="tab-common">
						<ul class="nav nav-tabs">
							<foreach name="config['Common']" item="ccommon">
								<li class="{$key?'':'active'}" >
								<a href="#tab-common-{$ccommon.config_group_id}" data-toggle="tab">{$ccommon.title}</a></li>
							</foreach>
						</ul>
						<div class="tab-content">
						<foreach name="config['Common']" item="ccommon">
							<div class="tab-pane {$key?'':'active'}" id="tab-common-{$ccommon.config_group_id}">
								<foreach name="ccommon['config']" item="cf">
									<div class="form-group">
										<label for="input-{$ccommon.config_group_id}-{$cf.key}" class="col-sm-2 control-label">{$cf.title}  <if condition="$cf['remark']"><span class="text-primary" data-toggle="tooltip" title="{$cf.remark}"><i class="fa fa-question-circle"></i></span></if></label>
										<div class="col-sm-10">
											<switch name="cf['type']">
												<case value="1">
													<input type="text" name="Common[{$cf.key}]" class="form-control" placeholder="{$cf.title}" value="{$cf.value|default=''}" id="input-{$ccommon.config_group_id}-{$cf.key}">
												</case>
												<case value="2">
													<input type="number" name="Common[{$cf.key}]" class="form-control" placeholder="{$cf.title}" value="{$cf.value|default=''}" id="input-{$ccommon.config_group_id}-{$cf.key}">													
												</case>
												<case value="3">
													<label class="radio-inline">
														<input type="radio" value="1" name="Common[{$cf.key}]" {:(isset($cf['value']) && $cf['value']==1)?'checked':''}> {:L('text_yes')}
													</label>
													<label class="radio-inline">
														<input type="radio" value="0" name="Common[{$cf.key}]" {:(isset($cf['value']) && $cf['value']==1)?'':'checked'}> {:L('text_no')}
													</label>
												</case>
												<case value="4">
													<select name="Common[{$cf.key}]" id="input-{$ccommon.config_group_id}-{$cf.key}" class="form-control">
														<foreach name="cf['extra']" item="ext">
															<option {:(isset($cf['value']) && $cf['value']==$ext['value'])?'selected':''} value="{$ext.value}">{$ext.title}</option>
														</foreach>
													</select>
												</case>
												<case value="5">
													<a href="" id="thumb-image-{$ccommon.config_group_id}-{$cf.key}" data-toggle="image" class="img-thumbnail"><img src="{$cf['thumb']}" alt="" title="" data-placeholder="{$placeholder}" /></a>
                  									<input type="hidden" name="Common[{$cf.key}]" value="{$cf.value|default=''}" id="input-{$ccommon.config_group_id}-{$cf.key}" />
												</case>
												<default/>
											</switch>
										</div>
									</div>
								</foreach>
							</div>
						</foreach>
						</div>
					</div>
				</div>
			</form>			
		</div>		
	</div>
</block>